package stage1.module4.Q1;

public class Staff {

    private String name;
    private int age;

    public Staff(String name, int age) throws Exception {
        if (name == null || name.length() == 0) {
            throw new EmptyException("invalid name");
        }
        if (age < 18 || age > 150) {
            throw new AgeException("invalid age");
        }
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Staff{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
